package android.coocoo.views;

import android.app.Activity;
import android.content.Intent;
import android.coocoo.common.Const;
import android.coocoo.models.CategoryInfo;
import android.coocoo.models.TaskInfo;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.ImageView;

public class DisplayCategoryInfoActivity extends Activity{
	
	EditText edCategoryName;
	ImageView btCategoryName;
	
	CategoryInfo category;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.display_category_info);
		
		category = (CategoryInfo)getIntent().getParcelableExtra("category");
		
		edCategoryName = (EditText)findViewById(R.id.etCategoryName);
		edCategoryName.setText(category.getTitle());
		
		btCategoryName = (ImageView)findViewById(R.id.btSaveCategory);
		btCategoryName.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
				category.setTitle(edCategoryName.getText().toString());
				
				Intent intent = new Intent();
				setResult(Const.Result.SUCCESS, intent);				
				intent.putExtra("returnCategory", category);
				finish();
			}
		});
	}

}
